'''
Created on 2012-4-11下午9:35:07

@author: yasenagat
@email:   yasenagat@gmail.com

'''
from ftplib import FTP

def upload():

    ftp = FTP("localhost")
    
    ftp.login("a", "a")
    
    file = open("d:/1.jpg","rb")
    
    ftp.storbinary("stor abc.jpg",file)
    
    ftp.close()
    
def download():
    
    ftp = FTP("localhost")
    
    ftp.login("a", "a")
    
    file = open("d:/download/d.jpg","wb")
    
    ftp.retrbinary("retr abc.jpg", file.write)
    
    ftp.close()
    
def list():
    
    ftp = FTP("localhost")
    
    ftp.login("a", "a")
    
    ftp.dir()
    
    ftp.close()
    
def delete():
    
    ftp = FTP("localhost")
    
    ftp.login("a", "a")
    
    ftp.delete("icts.jpg")
    
    ftp.close()
    
def rename():
    
    ftp = FTP("localhost")
    
    ftp.login("a", "a")
    
    ftp.rename("icts.sql","new_icts.sql.bak")
    
    ftp.close()
    
def mkdir():
    
    ftp = FTP("localhost")
    
    ftp.login("a", "a")
    
    ftp.mkd("nagat")
    
    ftp.close()
    
def rmdir():
    
    ftp = FTP("localhost")
    
    ftp.login("a", "a")
    
    ftp.rmd("nagat")
    
    ftp.close()
    
def pwd():
    
    ftp = FTP("localhost")
    
    ftp.login("a", "a")
    
    ftp.pwd()
    
    ftp.close()
    
def size():
    
    ftp = FTP("localhost")
    
    ftp.login("a", "a")
    
    s = ftp.size("1.exe")
    print(s)
    ftp.close()
    
    

#download()
#delete()
#rename()

#mkdir()
#rmdir()

#pwd()

size()
#list()
    

